package top.xzxsrq.fileviewutils.adviceorconfig;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.xzxsrq.fileviewutils.exception.BusinessException;
import top.xzxsrq.web.utils.AjaxResult;
import top.xzxsrq.web.utils.ResultCode;

@RestControllerAdvice
public class GlobalExceptionHandler {

    // 根据实际自定义的异常统一处理
    @ExceptionHandler(value = BusinessException.class)
    public AjaxResult operationError(BusinessException e) {
        return AjaxResult.failure(ResultCode.FAIL, e.getMessage());
    }

}
